<%@ page import="org.json.JSONObject" %>
<%@ page import="com.gmono.managers.Comment" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.gmono.managers.Common" %>
<%@ page import="java.sql.SQLException" %><%--
  Created by IntelliJ IDEA.
  User: gaozijian
  Date: 2018/12/29
  Time: 11:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    request.setCharacterEncoding("UTF-8");
    int id= Integer.parseInt(request.getParameter("id"));
    ArrayList<Comment> comments=new ArrayList<>();
    try {
        comments= Common.ResultToCollection(Common.Query("select * from comment where id=?",Integer.valueOf(id)), row->Comment.getObject(Comment.class,row));
    } catch (SQLException e) {
        e.printStackTrace();
    }
    Comment tc=comments.get(0);
    JSONObject object=new JSONObject(tc);
    out.print(object.toString());
%>